<script language="javascript" src="include/js/validate.js"></script>
<script language="javascript" src="include/js/jquery.js?v=1.3.2"></script>
<script>
function getpageid(searchkey)
{
	$.ajax({
			type: "POST",
			url: "admincp.php",
			data: "action=block&op=getpageid&searchkey="+searchkey,
			success: function(msg){
				if(msg == '1') {
					alert('搜索的关键字不能为空');
				} else if(msg == '2') {
					alert('您输入的关键字太长了，精简一下或许会有更好的效果！');
				} else {
					$('#searchtr').show();
					$('#resultsearch').html(msg);
					$('#resultsearch').show();	
				}
			}
		});
}
function insertsid(sid)
{
	$(function() {
		$('#pageid').val("zt_"+sid);
	})
}
</script>
	<div id="nav">
		当前位置: <a href="?action=default">管理首页</a> <span>&gt;</span> 添加碎片
	</div>
	<form id="theform" name="theform" action="" method="post" class="block" enctype="multipart/form-data" onSubmit="return Validator.Validate(this,2);">
	<table summary="" cellpadding="0" cellspacing="0" border="0" width="100%">
		<tr>
		<th style="padding-bottom: 5px; font-size: 12px; font-weight: bold;"><em>*为必填项</em></th>
		<td>&nbsp;</td>
		</tr>
		
		<tr>
		<th style="width: 7em;"><em>碎片名称 *</em></th>
		<td><input name="d[blockname]" type="text" id="blockname" size="60" maxlength="80" dataType='Require' msg='请填写碎片名称' /><div id="blocknametips" class="tips">碎片名称不超过20个字符</div></td>
		</tr>
		
		<tr>
		<th style="width: 7em;"><em>页面标识符 *</em></th>
		<td><input name="d[pageid]" type="text" id="pageid" size="10" maxlength="20" dataType='Require' msg='请填写页面标识符' <? if($pageid){?>value=<?=$pageid?> <? }?>/><div id="pageidtips" class="tips">页面标识符要唯一</div></td>
		</tr>
        
		<tr>
		<th style="width: 7em;"><em>搜索专题 </em></th>
		<td><input name="d[searchpageid]" type="text" id="searchpageid" size="10" maxlength="20" onchange="getpageid(this.value)" /><div id="searchpageidtips" class="tips">请输入专题关键字</div></td>
		</tr>
        
         <tr id="searchtr" style="display:none">
		<th style="width: 7em;"><em>搜索结果</em></th>
		<td id="resultsearch"></td>
		</tr>
        
		<tr>
		<th style="width: 7em;"><em>碎片编号 *</em></th>
		<td><input name="d[blockno]" type="text" id="blockno" size="10" maxlength="2" dataType='Require' msg='请填写碎片编号' /><div id="blocknotips" class="tips">每个页面碎片编号要唯一</div></td>
		</tr>
		
		<tr>
		<th><em>排序权值 *</em></th>
		<td><input name="d[listorder]" type="text" id="listorder" size="3" maxlength="2" dataType='Require' msg='请填写排序权值' /><div id="listordertips" class="tips">越小排序越靠前，默认为0</div></td>
		</tr>
		
		<tr>
		<th><em>碎片格式 *<em></th>
		<td><input type="radio" name="d[isarray]" id="isarray" value="1" checked onclick="$('#d_rows').show();"> 格式化碎片（输入标题、链接、缩略图、日期、简介）<br/>
	  		<input type="radio" name="d[isarray]" id="isarray" value="0" onclick="$('#d_rows').hide();$('#rows').attr('value','');"> 代码碎片（输入html代码）
		</td>
		</tr>
		
		<tr id="d_rows" style="display:">
		<th><em>数据条数 *<em></th>
		<td><input name="d[rows]" id="rows" type="text" size="3" /> 条</td>
		</tr>
		
		<tr>
		<th>&nbsp;</th>
		<td>
		<button value="true" type="submit" name="dosubmit" class="submit">下一步</button></td>
		</tr>
	</table>
	</form>